package edu.xidian.sselab.cloudcourse.controller;

import edu.xidian.sselab.cloudcourse.domain.test9_entity;
import edu.xidian.sselab.cloudcourse.repository.test9_Repository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ResponseBody;

import java.io.IOException;
import java.util.List;

@Controller
public class test9_controller {

    @Autowired
    private test9_Repository test9_repository;

    @RequestMapping("/test9")
    public String test9_try(Model model){
        model.addAttribute("title", "MPV各国系销量占比");
        return "test9";
    }

    @RequestMapping("/test25")
    public  @ResponseBody
    List test9_try2() throws IOException {

        List<test9_entity> recordList = test9_repository.find();

        System.out.println("以下是各国系MPV车系销量：");
        for(test9_entity t:recordList){
            System.out.println(t);
        }
        return recordList;
    }
}
